#include "random.h"
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;

// for using rdtsc initrand(Time());
vector <int> all;

void Do(int n)
{
	int k;
	for (k = 1; k < n; k++)
	{
		if (n % k == 0) all.push_back(k);
	}
	sort(all.begin(), all.end());
	k = all[(all.size() -  1) / 2];
	printf("%d %d\n", n, k);
	int i;
	for (i = 0; i < n; i++)
	{
		printf( "%d ", R(0, 1000000000));
	}
	printf("\n");
}

int main(int argc, char ** argv)
{
	initrand(Time());
	int K = atoi(argv[1]);
	int N = atoi(argv[2]);
	cout << K << "\n";
	int i;
	for (i = 0; i < K; i++)
	{
		Do(R(2, N));
	}
	
	return 0;
}